const randomOneToFour = function() {
    let a = [1, 2, 3, 4, 5]
    let n = Math.random() * 10
    n = Math.ceil(n)
    let r = n % 5
    return a[r]
}
const randomLine = function(n) {
    let result = []
    for (let i = 0; i < n; i++) {
        result.push(randomOneToFour())
    }
    return result
}
const randomSquare = function(width, height = width) {
    let result = []
    for (let i = 0; i < width; i++) {
        result.push(randomLine(height))
    }
    return result
}
const cellTemplate = function(n) {
    let o = {
        0: 'zero',
        1: 'one',
        2: 'two',
        3: 'three',
        4: 'four',
        5: 'five',
    }
    let t = `<div class="cell ${o[n]}"></div>`
    return t
}
const lineTemplate = function(arr) {
    let cells = ''
    for (let i = 0; i < arr.length; i++) {
        cells += cellTemplate(arr[i])
    }
    let line = `<div class="line">${cells}</div>`
    return line
}
const mapTemplate = function(arr) {
    let lines = ''
    for (let i = 0; i < arr.length; i++) {
        lines += lineTemplate(arr[i])
    }
    let map = `<div id="id-div-map" class="clearfix">${lines}</div>`
    return map
}
